<style>
	.t_text{float: left; width: 120px;}
	.t_game_notice_url{float: left;}
	.t_game_sever_list_url{float: left;}
	.t_login_server_address{float: left;}
	.t_login_server_port{float: left;}
</style>
<form method="post" action="/oss/?r=iosExamine/doEdit">
    <{include file='../common_params.tpl'}>
    <input type="hidden" name="id" value="<{$info.id}>" />
    <div class="box box-black">
        <div class="box-body">
            <table class="table table-bordered">
                <colgroup>
                    <col style="width: 20%;"></col>
                    <col style="width: 80%;"></col>
                </colgroup>
                
                <tr>
                    <th class="th-label">名称</th>
                    <td>
                        <input type="text" name="name" class="form-control inline" value="<{$info.name}>" placeholder="" />
                    </td>
                </tr>
                
                <tr>
                    <th class="th-label">包号</th>
                    <td>
                        <input type="text" name="packet" class="form-control inline" value="<{$info.packet}>" placeholder="" />
                    </td>
                </tr>
                
                <tr>
                    <th class="th-label">版本号</th>
                    <td>
                        <input type="text" name="v_num" class="form-control inline" value="<{$info.v_num}>" placeholder="" />
                    </td>
                </tr>
                
                <tr>
                    <th class="th-label">渠道</th>
                    <td>
                        <input type="text" name="channel" class="form-control inline" value="<{$info.channel}>" placeholder="" />
                    </td>
                </tr>
                
                
                <tr>
                    <th class="th-label">地址分类</th>
                    <td>
                    	<select name="category" class="form-control inline">
                    		<option value="">请选择</option>
                        <{foreach from=$catList item=item key=key}>
                        	<option value="<{$key}>" <{if $info.category == $key }>selected<{/if}>><{$item}></option>
                        <{/foreach}>
                        </select>
                    </td>
                </tr>
                
                <tr class="templet_info">
                    <th class="th-label"></th>
                    <td>
                    	<div class="t_text">游戏公告地址：</div><div class="t_game_notice_url" style="color: #428bca;"><{$catInfo.game_notice_url}></div><br />
                    	<div class="t_text">游戏服务器地址：</div><div class="t_game_sever_list_url" style="color: #428bca;"><{$catInfo.game_sever_list_url}></div><br />
                    	<div class="t_text">登录服务器地址：</div><div class="t_login_server_address" style="color: #428bca;"><{$catInfo.login_server_address}></div><br />
                    	<div class="t_text">登录服务器端口：</div><div class="t_login_server_port" style="color: #428bca;"><{$catInfo.login_server_port}></div><br />
                    </td>
                </tr>
                
            </table>
        </div>

        <div class="box-footer">
            <a href="<{$backUrl}>" class="btn btn-default">返回</a>
            <button type="submit" name="sub" class="btn btn-default pull-right">保存</button>
            <input type="hidden" name="page" value="<{$page}>" />
        </div>
    </div>
</form>

<script type="text/javascript">
    $(function(){
    	$(document).on('change','select[name = "category"]',function(){
        	var g = $('input[name="g"]').val();
	        var url = '?r=iosExamineCat/getInfo&g='+g;
        	
        	var id = $(this).val();
        	if(id == ''){
				$(".templet_info").hide();
				$(".t_game_notice_url").html('');
				$(".t_game_sever_list_url").html('');
				$(".t_login_server_address").html('');
				$(".t_login_server_port").html('');
				return false;
			}
        	
          	$.ajax({
	        	type : 'POST',
	        	url : url,
	        	async:false,
	        	data : {'id':id},
		        dataType :'JSON',
		        success : function(res){
		        	if(res.status){	
		        		$(".templet_info").show();
				        $(".t_game_notice_url").html(res.data.game_notice_url);
				        $(".t_game_sever_list_url").html(res.data.game_sever_list_url);
				        $(".t_login_server_address").html(res.data.login_server_address);
				        $(".t_login_server_port").html(res.data.login_server_port);
					   //layer.alert('设置成功', {icon: 1, skin: 'layui-layer-molv'});
			        }else{
			        	$(".t_game_notice_url").html('<font color="red">'+res.msg+'</font>');
				        $(".t_game_sever_list_url").html('<font color="red">'+res.msg+'</font>');
				        $(".t_login_server_address").html('<font color="red">'+res.msg+'</font>');
				        $(".t_login_server_port").html('<font color="red">'+res.msg+'</font>');
			        	layer.alert(res.msg, {icon: 2, skin: 'layui-layer-molv'});
			        	
			        }
		        }
	        });
        });
    	
    	
    	$('button[name="sub"]').click(function(){
    		var name = $('input[name="name"]').val();
        	if(name == ''){
        		layer.alert('请填写名称', {icon: 2, skin: 'layui-layer-molv'});
            	return false;
        	}
        	
    		var packet = $('input[name="packet"]').val();
        	if(packet == ''){
        		layer.alert('请填写包号', {icon: 2, skin: 'layui-layer-molv'});
            	return false;
        	}
        	
        	var v_num = $('input[name="v_num"]').val();
        	if(v_num == ''){
        		layer.alert('请填写版本号', {icon: 2, skin: 'layui-layer-molv'});
            	return false;
        	}
        	
        	var channel = $('input[name="channel"]').val();
        	if(channel == ''){
        		layer.alert('请填写渠道', {icon: 2, skin: 'layui-layer-molv'});
            	return false;
        	}       	
        	
        	var category = $('select[name="category"]').val();
        	if(category == ''){
        		layer.alert('请选择地址分类', {icon: 2, skin: 'layui-layer-molv'});
            	return false;
        	}
        	
        	
        });
    });
</script>